import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class Frame extends JFrame implements ActionListener {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private JTextField itemOne, itemTwo, itemThree;
    private JPasswordField password;

    public Frame() {
        super("Closet customizing softwre.");
        setSize(300, 200);
        setLayout(new FlowLayout());
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        itemOne = new JTextField(9);
        add(itemOne);
        itemTwo = new JTextField("You can't change me!", 9);
        itemTwo.setEditable(false);
        add(itemTwo);
        itemThree = new JTextField("Default Text", 15);
        password = new JPasswordField();
        add(password);
        itemOne.addActionListener(this);
        itemTwo.addActionListener(this);
        itemThree.addActionListener(this);
        password.addActionListener(this);
        setVisible(true);

        
    }

    @Override
    public void actionPerformed(ActionEvent event) {
        String MyString = "";

        if (event.getSource() == itemOne) {
            MyString = String.format("ItemOne:%s", event.getActionCommand());
        } else if (event.getSource() == itemTwo) {
            MyString = String.format("ItemTwo:%s", event.getActionCommand());
        } else if (event.getSource() == itemThree) {
            MyString = String.format("ItemThree:%s", event.getActionCommand());
        } else if (event.getSource() == password) {
            MyString = String.format("Password:%s", event.getActionCommand());
        }
        JOptionPane.showMessageDialog(null, MyString);
    }

}
